package com.liyuhan.onlinetaxibackground.Controller;

import com.liyuhan.onlinetaxibackground.Service.DriverService;
import com.liyuhan.onlinetaxibackground.dto.DataResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/driver")
public class DriverController {

    @Autowired
    private DriverService driverService;

    @RequestMapping("/saveLocation")
    public void saveLocation(@Valid @RequestBody String request){
        driverService.saveLocation(request);
    }

    @RequestMapping("/changeGetOrderState")
    public void changeGetOrderState(@Valid @RequestBody String request){
        driverService.changeGetOrderState(request);
    }

    @RequestMapping("/getCarInfo")
    public DataResponse getCarInfo(@Valid @RequestBody String request){
        return driverService.getCarInfo(request);
    }

    @RequestMapping("/saveCarInfo")
    public DataResponse saveCarInfo(@Valid @RequestBody String request){
        return driverService.saveCarInfo(request);
    }
}
